//
//  ZLCLinkUrlViewController.m
//  HappilyLoan
//
//  Created by 纵情向前 on 2017/4/14.
//  Copyright © 2017年 zongqingxiangqian. All rights reserved.
//

#import "ZLCLinkUrlViewController.h"
#import "ZFHeader.h"

@interface ZLCLinkUrlViewController ()<UIWebViewDelegate>
@property (nonatomic, strong)UIWebView *webView;
@property (nonatomic,strong) AnimatingView *anima;

@end

@implementation ZLCLinkUrlViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = self.titleStr;
    self.view.backgroundColor = [UIColor whiteColor];
    self.webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    self.webView.backgroundColor = [UIColor whiteColor];
    self.webView.scalesPageToFit = YES;
    self.webView.delegate = self;
    [self.view addSubview:self.webView];
    
    self.anima = [[AnimatingView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    
    ;
    NSURL *url = [NSURL URLWithString:[_url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
    NSURLRequest *requst = [NSURLRequest requestWithURL:url];
    [self.webView loadRequest:requst];
    // Do any additional setup after loading the view from its nib.
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    NSLog(@"%@",error);
}

- (void)webViewDidStartLoad:(UIWebView *)webView {
//    [_anima startTheSmallAnimation];//开始动画
//    NSLog(@"开始加载");
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
//    NSLog(@"加载完成");
    [_anima stopTheAnimation];
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [MobClick beginLogPageView:@"linkUrl"];
    self.navigationController.navigationBarHidden = NO;
    self.tabBarController.tabBar.hidden = YES;
    [_anima startTheAnimation];//开始动画
}
- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [MobClick endLogPageView:@"linkUrl"];
    [_anima stopTheAnimation];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
